/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NewJFrame.java
 *
 * Created on 01.apr.2011, 11:01:32
 */

package gui;

// <editor-fold defaultstate="collapsed" desc="TODO list">
// - ingenting foreløpig
// </editor-fold>

import java.sql.SQLException;
import java.util.Date;
import model.*;

/**
 *
 * @author MartinAcer
 */
public class MeetingOverview2 extends javax.swing.JFrame {
//----------------------- ferdig kode -------------------------------------------------
    String[] meetingTime = new String[] {"08-10", "10-12", "12-14", "14-16"};
    String[] meetingRoom = new String[] {"Room Blue", "Room Red", "Room Green"};
    String[] users;
    String[] madeInvitations;
    String[] rooms;
    Person currentPerson;
    Appointment currentAppointment;
    //Invitation currentInvitation;
    Meeting currentMeeting;
    Calendar currentCalendar;
    Room room;
    Date staticDate = new Date(10,10,10);
    int addAppTimeFrom;
    int addAppTimeTo;
    String headOfMeeting;
    String currentMeetingRoom;
    String currentMeetingTime;
    boolean moreThanFiveInv;
    boolean pendingVisible1 = false;
    boolean pendingVisible2 = false;
    boolean pendingVisible3 = false;
    boolean pendingVisible4 = false;
    boolean pendingVisible5 = false;
    Appointment[] pendingInvitation;
//----------------------- FERDIG TIL PRØVING, BARE Å ENABLE ---------------------------
    Person[] personArray = new Person[] {
            new Person("Jens", "Stoltenberg", "jens", "123", "jensegutt60@hotmail.com", 22225555, new Date(1960, 01, 01)),
            new Person("Siv", "Jensen", "siv", "123", "siv@gmail.com", 22225555, new Date(1962, 02, 02)),
            new Person("Erna", "Solberg", "erna", "123", "jern_erna@msn.no", 22225555, new Date(1964, 03, 03))
        };
    
    String[] testString = new String[] {"navn1", "navn2", "navn3"};


    /** Creates new form NewJFrame */
    public MeetingOverview2() {
        initUsers();
        initRooms();

        initComponents();
    }

    private void getPersonArray(){
// --------------------- ISH FERDIG -----------------------
//        for(int i=0; i<project.getPersonCount(); i++){
//            personArray[i] = project.getPerson(i);
//        }
    }

    private void getAppointments(){

    }

    private void initUsers(){
        users = new String[personArray.length];
        for(int i=0; i<personArray.length; i++){
            users[i] = personArray[i].getUsername();
        }
    }

    private void initRooms() {
        Roomlist roomlist = new Roomlist();
        for(int i=0; i<roomlist.getRoomCount(); i++){
            rooms[i] = roomlist.getRoomlist().get(i);
        }
    }

    private void updateInvitationList(){
        madeInvitations = new String[currentCalendar.getAppointments().size()];
        for(int i=0; i<currentCalendar.getAppointments().size(); i++){
            madeInvitations[i] = currentCalendar.getAppointments().get(i).getTitle();
        }
    }

    private void convertMeetingTime(int i){
        if(i==0){
            addAppTimeFrom = 8;
            addAppTimeTo = 10;
        }
        else if(i==1){
            addAppTimeFrom = 10;
            addAppTimeTo = 12;
        }
        else if(i==2){
            addAppTimeFrom = 12;
            addAppTimeTo = 14;
        }
        else if(i==3){
            addAppTimeFrom = 14;
            addAppTimeTo = 16;
        }
    }

    private void makeAppointment() {
        Appointment newApp = new Appointment(jTextField1.getText(), staticDate, addAppTimeFrom, addAppTimeTo, "uspesifisert", currentPerson.getID());
    }

    private void changeUser(Person user) {
        currentPerson = user;
        headOfMeeting = user.getFirstName();    //+evt etternavn

        // definerer ny calendar
        currentCalendar = new Calendar(currentPerson);
        updateInvitationList();
        listAppointments();

        // oppdaterer GUI
        jTextField4.setText(headOfMeeting);
        jComboBox4.setModel(new javax.swing.DefaultComboBoxModel(madeInvitations));

    };

    private void changeInvitation(Appointment appointment){
        currentAppointment = appointment;
        
        // oppdaterer GUI
        jTextField3.setText(appointment.getLocation());
        jTextField2.setText(appointment.getFromPointOfTime() + " til " + appointment.getToPointOfTime());
    }

    private void listAppointments(){
        pendingInvitation = new Appointment[currentCalendar.getAppointments().size()];
        for(int i=0; i<pendingInvitation.length || i<5; i++){
            pendingInvitation[i] = currentCalendar.getAppointments().get(i);
        }
        if(currentCalendar.getAppointments().size()>4){
            jLabel25.setVisible(true);
        }
        for(int i=0; i<pendingInvitation.length || i<5; i++){
            //lag visible på ønskede felter.
        }
    }

    public void reorganizeList(){
        //reorganize list
    }

// <editor-fold defaultstate="collapsed" desc="getPendingGUI() kode">

    private void getPendingGUI(){
                jLabelPending2.setText("Meeting invitation:");
        getContentPane().add(jLabelPending2, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 160, -1, -1));

        jTextFieldPending2.setEditable(false);
        getContentPane().add(jTextFieldPending2, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 180, 220, -1));

        jButton1Pending2.setText("Accept");
        jButton1Pending2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1Pending2ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton1Pending2, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 210, 90, -1));

        jButton2Pending2.setText("Reject");
        jButton2Pending2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2Pending2ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton2Pending2, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 210, 90, -1));

        jLabelPending3.setText("Meeting invitation:");
        getContentPane().add(jLabelPending3, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 250, -1, -1));

        jTextFieldlPending3.setEditable(false);
        getContentPane().add(jTextFieldlPending3, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 270, 220, -1));

        jButton1Pending3.setText("Accept");
        jButton1Pending3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1Pending3ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton1Pending3, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 300, 90, -1));

        jButton2Pending3.setText("Reject");
        jButton2Pending3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2Pending3ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton2Pending3, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 300, 90, -1));

        jLabelPending4.setText("Meeting invitation:");
        getContentPane().add(jLabelPending4, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 340, -1, -1));

        jTextFieldPending4.setEditable(false);
        getContentPane().add(jTextFieldPending4, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 360, 220, -1));

        jButton1Pending4.setText("Accept");
        jButton1Pending4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1Pending4ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton1Pending4, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 390, 90, -1));

        jButton2Pending4.setText("Reject");
        jButton2Pending4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2Pending4ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton2Pending4, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 390, 90, -1));

        jLabelPending5.setText("Meeting invitation:");
        getContentPane().add(jLabelPending5, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 430, -1, -1));

        jTextFieldPending5.setEditable(false);
        getContentPane().add(jTextFieldPending5, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 450, 220, -1));

        jButton1Pending5.setText("Accept");
        jButton1Pending5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1Pending5ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton1Pending5, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 480, 90, -1));

        jButton2Pending5.setText("Reject");
        jButton2Pending5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2Pending5ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton2Pending5, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 480, 90, -1));
    }

// </editor-fold>

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel2 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jLabel9 = new javax.swing.JLabel();
        jLabelPending1 = new javax.swing.JLabel();
        jTextFieldPending1 = new javax.swing.JTextField();
        jButton1Pending1 = new javax.swing.JButton();
        jButton2Pending1 = new javax.swing.JButton();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jTextField2 = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jButton4 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jLabel15 = new javax.swing.JLabel();
        jTextField3 = new javax.swing.JTextField();
        jComboBox2 = new javax.swing.JComboBox();
        jComboBox4 = new javax.swing.JComboBox();
        jComboBox5 = new javax.swing.JComboBox();
        jButton6 = new javax.swing.JButton();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jTextField4 = new javax.swing.JTextField();
        jComboBox1 = new javax.swing.JComboBox();
        jLabel1 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jButton7 = new javax.swing.JButton();
        jLabelPending2 = new javax.swing.JLabel();
        jTextFieldPending2 = new javax.swing.JTextField();
        jButton1Pending2 = new javax.swing.JButton();
        jButton2Pending2 = new javax.swing.JButton();
        jLabelPending3 = new javax.swing.JLabel();
        jTextFieldlPending3 = new javax.swing.JTextField();
        jButton1Pending3 = new javax.swing.JButton();
        jButton2Pending3 = new javax.swing.JButton();
        jLabelPending4 = new javax.swing.JLabel();
        jTextFieldPending4 = new javax.swing.JTextField();
        jButton1Pending4 = new javax.swing.JButton();
        jButton2Pending4 = new javax.swing.JButton();
        jLabelPending5 = new javax.swing.JLabel();
        jTextFieldPending5 = new javax.swing.JTextField();
        jButton1Pending5 = new javax.swing.JButton();
        jButton2Pending5 = new javax.swing.JButton();
        jLabel25 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jComboBox3 = new javax.swing.JComboBox();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(1200, 630));
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabel2.setText("Add invitation");
        getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 30, -1, -1));

        jList1.setModel(new javax.swing.AbstractListModel() {
            public int getSize() { return personArray.length; }
            public Object getElementAt(int i) { return personArray[i].getFirstName(); }
        });
        jList1.setToolTipText("Hold ctrl to select more than one.");
        jScrollPane1.setViewportView(jList1);

        getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 150, 120, 190));

        jLabel3.setText("Head of meeting:");
        getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 70, -1, -1));

        jLabel4.setText("Select participants:");
        getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 130, -1, -1));

        jButton1.setText("Send invitation");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 510, 120, -1));

        jLabel5.setText("Choose a describing title:");
        getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 450, -1, -1));

        jLabel6.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabel6.setText("Pending meeting invitations");
        getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 30, -1, -1));
        listAppointments();

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabel7.setText("Current calendar");
        getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(700, 30, -1, -1));

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null}
            },
            new String [] {
                "Monday", "Thuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"
            }
        ));
        jScrollPane3.setViewportView(jTable1);

        getContentPane().add(jScrollPane3, new org.netbeans.lib.awtextra.AbsoluteConstraints(700, 70, 480, 240));

        jLabel9.setVisible(false);
        jLabel9.setText("Invitation sent");
        getContentPane().add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 540, -1, -1));

        jLabelPending1.setText("Meeting invitation:");
        jLabelPending1.setVisible(pendingVisible1);
        getContentPane().add(jLabelPending1, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 70, -1, -1));

        jTextFieldPending1.setVisible(pendingVisible1);
        jTextFieldPending1.setEditable(false);
        getContentPane().add(jTextFieldPending1, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 90, 220, -1));

        jButton1Pending1.setVisible(pendingVisible1);
        jButton1Pending1.setText("Accept");
        jButton1Pending1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1Pending1ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton1Pending1, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 120, 90, -1));

        jButton2Pending1.setVisible(pendingVisible1);
        jButton2Pending1.setText("Reject");
        jButton2Pending1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2Pending1ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton2Pending1, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 120, 90, -1));

        jLabel11.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabel11.setText("Invitation properties");
        getContentPane().add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 30, -1, -1));

        jLabel12.setText("Choose time:");
        getContentPane().add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 350, -1, -1));

        jLabel13.setText("Choose invitation:");
        getContentPane().add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 70, -1, -1));

        jTextField2.setEditable(false);
        getContentPane().add(jTextField2, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 210, 170, -1));

        jLabel14.setText("Current time:");
        getContentPane().add(jLabel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 190, -1, -1));

        jButton4.setText("Cancel meeting");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 420, 170, -1));

        jButton5.setText("Send mail remainder");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 360, 170, -1));

        jLabel15.setText("Current meeting room:");
        getContentPane().add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 130, -1, -1));

        jTextField3.setEditable(false);
        jTextField3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField3ActionPerformed(evt);
            }
        });
        getContentPane().add(jTextField3, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 150, 170, -1));

        jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(meetingTime));
        getContentPane().add(jComboBox2, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 370, 120, -1));

        jComboBox4.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jComboBox4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox4ActionPerformed(evt);
            }
        });
        getContentPane().add(jComboBox4, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 90, 170, -1));

        jComboBox5.setModel(new javax.swing.DefaultComboBoxModel(meetingTime));
        getContentPane().add(jComboBox5, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 260, 170, -1));

        jButton6.setText("Change time");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton6, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 300, 170, -1));

        jLabel16.setVisible(false);
        jLabel16.setText("Time changed");
        getContentPane().add(jLabel16, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 330, -1, -1));

        jLabel17.setVisible(false);
        jLabel17.setText("Mail remainder sent");
        getContentPane().add(jLabel17, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 390, -1, -1));

        jLabel18.setVisible(false);
        jLabel18.setText("Meeting cancelled");
        getContentPane().add(jLabel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 450, -1, -1));

        jLabel19.setText("Choose new time:");
        getContentPane().add(jLabel19, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 240, -1, -1));

        jTextField4.setEditable(false);
        jTextField4.setText(headOfMeeting);
        getContentPane().add(jTextField4, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 90, 120, -1));

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(users));
        jComboBox1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox1ActionPerformed(evt);
            }
        });
        getContentPane().add(jComboBox1, new org.netbeans.lib.awtextra.AbsoluteConstraints(700, 400, 250, -1));

        jLabel1.setText("Choose user:");
        getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(700, 380, -1, -1));

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabel8.setText("Change user");
        getContentPane().add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(700, 340, -1, -1));

        jButton7.setText("OK");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton7, new org.netbeans.lib.awtextra.AbsoluteConstraints(970, 400, -1, -1));

        jLabelPending2.setText("Meeting invitation:");
        getContentPane().add(jLabelPending2, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 160, -1, -1));

        jTextFieldPending2.setEditable(false);
        getContentPane().add(jTextFieldPending2, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 180, 220, -1));

        jButton1Pending2.setText("Accept");
        jButton1Pending2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1Pending2ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton1Pending2, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 210, 90, -1));

        jButton2Pending2.setText("Reject");
        jButton2Pending2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2Pending2ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton2Pending2, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 210, 90, -1));

        jLabelPending3.setText("Meeting invitation:");
        getContentPane().add(jLabelPending3, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 250, -1, -1));

        jTextFieldlPending3.setEditable(false);
        getContentPane().add(jTextFieldlPending3, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 270, 220, -1));

        jButton1Pending3.setText("Accept");
        jButton1Pending3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1Pending3ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton1Pending3, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 300, 90, -1));

        jButton2Pending3.setText("Reject");
        jButton2Pending3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2Pending3ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton2Pending3, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 300, 90, -1));

        jLabelPending4.setText("Meeting invitation:");
        getContentPane().add(jLabelPending4, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 340, -1, -1));

        jTextFieldPending4.setEditable(false);
        getContentPane().add(jTextFieldPending4, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 360, 220, -1));

        jButton1Pending4.setText("Accept");
        jButton1Pending4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1Pending4ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton1Pending4, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 390, 90, -1));

        jButton2Pending4.setText("Reject");
        jButton2Pending4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2Pending4ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton2Pending4, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 390, 90, -1));

        jLabelPending5.setText("Meeting invitation:");
        getContentPane().add(jLabelPending5, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 430, -1, -1));

        jTextFieldPending5.setEditable(false);
        getContentPane().add(jTextFieldPending5, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 450, 220, -1));

        jButton1Pending5.setText("Accept");
        jButton1Pending5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1Pending5ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton1Pending5, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 480, 90, -1));

        jButton2Pending5.setText("Reject");
        jButton2Pending5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2Pending5ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton2Pending5, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 480, 90, -1));

        jLabel25.setVisible(false);
        jLabel25.setText("You have more than 5 invitations");
        getContentPane().add(jLabel25, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 520, -1, -1));
        getContentPane().add(jTextField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 470, 120, -1));

        jLabel10.setText("Choose meeting room:");
        getContentPane().add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 400, -1, -1));

        jComboBox3.setModel(new javax.swing.DefaultComboBoxModel(rooms));
        getContentPane().add(jComboBox3, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 420, 120, -1));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        makeAppointment();
        jLabel9.setVisible(true);
}//GEN-LAST:event_jButton1ActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        // send a cancellation to all participants
        currentMeeting.Cancel();
        jLabel18.setVisible(true);
}//GEN-LAST:event_jButton4ActionPerformed

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
        // changes the current user
        changeUser(personArray[jComboBox1.getSelectedIndex()]);
    }//GEN-LAST:event_jButton7ActionPerformed

    private void jButton1Pending2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1Pending2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton1Pending2ActionPerformed

    private void jButton2Pending2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2Pending2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton2Pending2ActionPerformed

    private void jButton1Pending3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1Pending3ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton1Pending3ActionPerformed

    private void jButton2Pending3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2Pending3ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton2Pending3ActionPerformed

    private void jButton1Pending4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1Pending4ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton1Pending4ActionPerformed

    private void jButton2Pending4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2Pending4ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton2Pending4ActionPerformed

    private void jButton1Pending5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1Pending5ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton1Pending5ActionPerformed

    private void jButton2Pending5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2Pending5ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton2Pending5ActionPerformed

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
        // changes the time of the meeting
        convertMeetingTime(jComboBox5.getSelectedIndex());
        currentAppointment.setFromPointOfTime(addAppTimeFrom);
        currentAppointment.setToPointOfTime(addAppTimeTo);
        jLabel16.setVisible(true);
    }//GEN-LAST:event_jButton6ActionPerformed

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
        // sends an appointment remainder
        //currentAppointment.;
        jLabel17.setVisible(true);
    }//GEN-LAST:event_jButton5ActionPerformed

    private void jButton1Pending1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1Pending1ActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jButton1Pending1ActionPerformed

    private void jButton2Pending1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2Pending1ActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jButton2Pending1ActionPerformed

    private void jComboBox4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox4ActionPerformed
        // TODO add your handling code here:
        changeInvitation(currentCalendar.getAppointments().get(jComboBox4.getSelectedIndex()));
    }//GEN-LAST:event_jComboBox4ActionPerformed

    private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jComboBox1ActionPerformed

    private void jTextField3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField3ActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MeetingOverview2().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton1Pending1;
    private javax.swing.JButton jButton1Pending2;
    private javax.swing.JButton jButton1Pending3;
    private javax.swing.JButton jButton1Pending4;
    private javax.swing.JButton jButton1Pending5;
    private javax.swing.JButton jButton2Pending1;
    private javax.swing.JButton jButton2Pending2;
    private javax.swing.JButton jButton2Pending3;
    private javax.swing.JButton jButton2Pending4;
    private javax.swing.JButton jButton2Pending5;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JComboBox jComboBox2;
    private javax.swing.JComboBox jComboBox3;
    private javax.swing.JComboBox jComboBox4;
    private javax.swing.JComboBox jComboBox5;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabelPending1;
    private javax.swing.JLabel jLabelPending2;
    private javax.swing.JLabel jLabelPending3;
    private javax.swing.JLabel jLabelPending4;
    private javax.swing.JLabel jLabelPending5;
    private javax.swing.JList jList1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTable jTable1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField4;
    private javax.swing.JTextField jTextFieldPending1;
    private javax.swing.JTextField jTextFieldPending2;
    private javax.swing.JTextField jTextFieldPending4;
    private javax.swing.JTextField jTextFieldPending5;
    private javax.swing.JTextField jTextFieldlPending3;
    // End of variables declaration//GEN-END:variables

//    // deklarasjon til listAppointments metoden
//    private javax.swing.JButton jButtonPending03;
//    private javax.swing.JLabel jLabelPending01;
//    private javax.swing.JTextField jTextFieldPending02;
//    private javax.swing.JButton jButton3Pending04;
//
//    // listener til buttons
//    private void jButton3Pending04ActionPerformed(java.awt.event.ActionEvent evt) {
//        // TODO add your handling code here:
//    }
//    private void jButtonPending03ActionPerformed(java.awt.event.ActionEvent evt) {
//        // TODO add your handling code here:
//    }

}
